//
//  SEGBasicWKWebViewController.h
//  SEGWebView
//
//  Created by 山刘 on 2020/3/16.
//

#import <UIKit/UIKit.h>
#import <WebKit/WebKit.h>




NS_ASSUME_NONNULL_BEGIN

@interface SEGBasicWKWebViewController : UIViewController<WKNavigationDelegate,WKUIDelegate,UIScrollViewDelegate,WKScriptMessageHandler,UIAlertViewDelegate>
@property (nonatomic, strong)WKWebView *webView;

@property (strong, nonatomic) UIProgressView *progressView;

/// 第一次进进入的URL地址
@property (nonatomic, copy) NSString *linkURL;

/// 当前正在活动状态的URL地址
@property (nonatomic, copy) NSURL *currentUrl;

/// 当前uhomeoc协议的地址
@property (nonatomic, copy) NSURL *current_uhomeoc_href;

/// 网页支付的cbUrl
@property (nonatomic, copy) NSString *cbUrlString;

/// 通过url参数(isHideHeader)判断网页加载导航栏显示和隐藏情况：1:隐藏系统导航栏，其他：显示
@property (nonatomic, assign) BOOL isHideHeader;

/// 判断是否是无纸化协议
@property (nonatomic, assign) BOOL agreement;

/// 更新进度条
-(void)updateProgress:(CGFloat)value;

#pragma mark - 数据加载、刷新
/// 加载网页数据
-(NSString*)loadDataWithURLString:(NSString*)urlString;
/// 加载网页支付 cbUrl
-(void)loadCbUrlString;

#pragma mark - 父类抽象方法
/// 添加子视图
-(void)segAddSubview;

/// 添加监听KVO
-(void)segAddKVO;

/// 添加通知
-(void)segAddNotifications;

/// JS协议拦截
/// @param webView webView
/// @param request request
/// @param query query 经过了逻辑处理后的query
-(BOOL)jsInvokeSystemFunctionWithWebView:(WKWebView *)webView request:(NSURLRequest *)request query:(NSString *)query;

/// URL地址参数替换
-(NSString*)segReplaceUrlStringWithUrlString:(NSString *)urlString;

/// URL地址添加平台号
-(NSString*)getUrlStringWithAppPlatformCode:(NSString *)urlString;

/// 是否展示进度条，默认NO。
-(BOOL)isShowProgressView;

/**
 网络请求失败
 
 @author Sam
 */
-(void)requestFailWithWebView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error;

@end

NS_ASSUME_NONNULL_END
